package fun.asgc.boot.netty.web.test1;

import fun.asgc.boot.netty.web.context.HttpRequestWrapper;
import fun.asgc.boot.netty.web.context.HttpResponseWrapper;
import fun.asgc.boot.netty.web.interceptor.HandlerInterceptor;
import lombok.extern.slf4j.Slf4j;

import java.lang.reflect.Method;

/**
 *
 * @author: aoshiguchen
 * @date: 2022/7/28
 */
@Slf4j
public class BaseAuthInterceptor implements HandlerInterceptor {

	/**
	 * 登录验证
	 * @param requestParser
	 * @param responseWrapper
	 * @param route
	 * @param targetMethod
	 * @return
	 * @throws Exception
	 */
	@Override
	public boolean preHandle(HttpRequestWrapper requestParser, HttpResponseWrapper responseWrapper, String route, Method targetMethod) throws Exception {
		// 登录验证
//		String authorize = requestParser.getHeaderValue("Authorize");
//		if (!"123abc".equals(authorize)) {
//			throw new UserNotLoginException();
//		}
		return Boolean.TRUE;
	}
}
